package notes.java.sjms23.t12_iterator;

import java.util.List;

// 具体迭代 对象迭代
public class ObjctIterator implements MyIterator{
    
    private List<Object> list;
    
    public ObjctIterator(List<Object> list) {
        this.list = list;
    }

    private int index = 0;
    
    @Override
    public boolean hasNext() {
        if(list.size() > index) {
            return true;
        }
        return false;
    }

    @Override
    public Object next() {
        Object obj = list.get(index);
        index ++;
        return obj;
    }

}
